/**
 * Copyright 2008 floop.pl
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * You may not use this file except in compliance with the License.
 * You may obtain a copy of the License at 
 *  
 * http://www.apache.org/licenses/LICENSE-2.0 
 *  
 * Unless required by applicable law or agreed to in writing, software distributed
 * under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 */
package org.eaicompiler.model;

import java.util.HashMap;
import java.util.Map;

/**
 * Holds the localized texts
 * 
 * @author floop.pl
 */
public class LocalizedText {
	public final static int			ENGLISH				= 0;
	// I have only basic knowledge of indexes here
	public final static int			FRENCH				= 2;
	public final static int			GERMAN				= 3;

	private int						id;

	private Map<Integer, String>	localizedTextsMap	= new HashMap<Integer, String>();

	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}

	public void addLocalizedText(int language, String text) {
		localizedTextsMap.put(new Integer(language), text);
	}

	public String getLocalizedText(int language) {
		return localizedTextsMap.get(new Integer(language));
	}
	
	/**
	 * Returns the ID of the language. Quick and dirty, I know.
	 * 
	 * @param language
	 *            Language string
	 * @return Language ID
	 */
	public static int getLanguageId(String language) {
		if ("FRENCH".equals(language)) {
			return FRENCH;
		}
		if ("GERMAN".equals(language)) {
			return GERMAN;
		}
		return ENGLISH;
	}	
}
